class Solution:
    # 使用字典
    def repeatedCharacter(self, s: str) -> str:
        char_dict = dict()
        for i in s:
            if i in char_dict:
                char_dict[i]+=1
                if char_dict[i] == 2:
                    print(char_dict)
                    return i
            else:
                char_dict[i] = 1
    # 使用set
    def repeatedCharacter1(self, s: str) -> str:
        t = set()
        for i in s:
            if i not in t:
                t.add(i)
            else:
                return i
        return None




# 简单题
if __name__ == '__main__':
    s = "abccbaacz"
    solution = Solution()
    val = solution.repeatedCharacter1(s)
    print(val)